package com.study.designpartten.single;

/**
 * 枚举单例模式
 */
public class Singleton3 {

    private Singleton3(){}

    enum EnumLayer{
        instance;
        private static Singleton3 ins = new Singleton3();
        public static Singleton3 getIntance(){
            return ins;
        }
    }

    public static void main(String[] args) {
        Singleton3 s1 = Singleton3.EnumLayer.getIntance();
        Singleton3 s2 = Singleton3.EnumLayer.getIntance();
        System.out.println(s1==s2);
    }



}
